<%--
  Created by IntelliJ IDEA.
  User: LL
  Date: 2024/8/16
  Time: 21:57
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>增加图书</title>
    <%
        String base = request.getContextPath() + "/";
        String url = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + base;
    %>
    <base href="<%=url%>">
    <script type="text/javascript" src="js/jquery-1.8.3%20(1).js"></script>
    <script>
        $(document).ready(function () {
         $("[type='button']").click(function() {
            var bnaem = $("[name='bookName']").val();

            var aname = $("[name='bookAuthor']").val();

            var cname = $("[name='bookPublish']").val();
            var page = $("[name='bookPage']").val();
            var price = $("[name='bookPrice']").val();
            $.get("book/addBook",{"bname":bnaem,"aname":aname,"cname":cname,"page":page,"price":price},function (str) {
               JSON.stringify(str);
               if (str){
                   alert("增加成功");
               }else {
                   alert("增加失败");
               }
            })

         })
        })

    </script>
</head>
<body>
<h1>增加图书</h1><br>
<a href="index.jsp">返回</a>
书名:<input type="text" name="bookName">*<br>
作者:<input type="text" name="bookAuthor">*<br>
出版社:<input type="text" name="bookPublish" >*<br>
页数:<input type="text" name="bookPage">*<br>
价格:<input type="text" name="bookPrice">*<br>
<input type="button" value="提交">*<br>

</body>
</html>
